home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 235 / Issue 235 - September 2007 - DPCS0907DVD.ISO / Extras / NetObjects Fusion / NOF10.exe / data1.cab / FSI / lib / nof / util / Locale.js < prev    next >
Encoding:
Text File  |  2007-04-11  |  2.2 KB  |  97 lines

  1. /****i* SOURCE_FILE/INFO
  2.   *
  3.   * NAME
  4.   *  Locale.js
  5.   *
  6.   * USAGE
  7.   *  Part of Netobjects JavaScript Library.
  8.   *
  9.   * COPYRIGHT
  10.   *  Copyright ⌐ 2000-2005 Website Pros, Inc.
  11.   *  All Rights Reserved.
  12.   *
  13.   *  This is an unpublished work protected by Website Pros, Inc.
  14.   *  as a trade secret, and is not to be used or disclosed except as
  15.   *  expressly provided in a written license agreement executed by
  16.   *  you and Website Pros, Inc.
  17.   *
  18.   *      <copyright@websitepros.com>
  19.   *
  20.   * NOTES
  21.   *  JavaScript code.
  22.   *
  23.   *****/
  24.  
  25. if (!IS.isModuleInitialized("IS.NOF.UTIL.Locale"))
  26. {
  27.  
  28.   /****h* NOF_JavaScript_Library/NOF.UTIL.Locale
  29.     *
  30.     * NAME
  31.     *  NOF.UTIL.Locale
  32.     *
  33.     * DESCRIPTION
  34.     *   A Locale object represents a specific geographical, political, or cultural region.
  35.     *   Usage:
  36.     *     new NOF.UTIL.Locale('de','DE');
  37.     *
  38.     ****/
  39.  
  40.   /**
  41.     * Constructor
  42.     * @param language
  43.     * @param country
  44.     */
  45.   function UTIL_Locale(/*string*/ language, /*string*/ country) {
  46.     this.__proto__ = UTIL_Locale.prototype;
  47.  
  48.     this.language  = language;
  49.     this.country   = country;
  50.   }
  51.   {
  52.  
  53.     var method = UTIL_Locale.prototype;
  54.  
  55.     /**
  56.       * Returns the language code for this locale.
  57.       **/
  58.     method.getLanguage  = function () {
  59.       return this.language;
  60.     }
  61.  
  62.     /**
  63.       * Returns the country code for this locale.
  64.       **/
  65.     method.getCountry   = function () {
  66.       return this.country;
  67.     }
  68.  
  69.     /**
  70.       * Returns the string representation for this locale as Language_Country ('de_DE').
  71.       **/
  72.     method.toString   = function () {
  73.       var toRetStr = this.language;
  74.       if ( this.country != null ) {
  75.         toRetStr += "_" + this.country;
  76.       }
  77.       return toRetStr;
  78.     }
  79.  
  80.     /**
  81.       * Equals method.
  82.       **/
  83.     method.equals       = function (/*NOF.UTIL.Locale*/ locale) {
  84.       return ((locale != null) && (typeof(locale) == 'object' ) &&
  85.         (this.language == locale.language) && (this.country == locale.country));
  86.     }
  87.  
  88.     /**
  89.       * Return the default locale
  90.       **/
  91.     method.getDefault = function () {
  92.       return NOF.UTIL.DefaultLocale;
  93.     }
  94.   }
  95.  
  96.   UTIL.__proto__.Locale = UTIL_Locale;
  97. }